
import javafx.stage.Stage;
import javafx.scene.Scene;
import javafx.scene.text.Text;
import javafx.scene.text.Font;
import javafx.scene.media.*;
import javafx.ext.swing.SwingButton;
import javafx.scene.control.CheckBox;
import javafx.scene.control.Label;
import javafx.scene.control.ProgressBar;
import javafx.scene.control.ProgressIndicator;
import javafx.scene.control.RadioButton;
import javafx.scene.control.Slider;
import javafx.scene.control.TextBox;
import javafx.scene.control.ToggleButton;
import javafx.scene.control.ToggleGroup;
import javafx.scene.layout.HBox;
import javafx.scene.layout.VBox;
import javafx.animation.Timeline;
import javafx.scene.control.Hyperlink;
import java.lang.System;
import javax.swing.JFileChooser;
import javafx.scene.image.ImageView;
import javafx.scene.image.Image;
import javafx.scene.shape.Circle;
import javafx.scene.paint.Color;
import javafx.scene.input.MouseEvent;




/**
 * @author goemb
 */


var player:MyMediaPlayer = new MyMediaPlayer();
var fileBox:TextBox = TextBox{}
var image = Image {
    url: "/Users/goemb/Documents/workspace/MediaPlayerFX/img/button_test.png"
}

def slider = Slider {
   max: 100
}

var isVisible:Boolean = false;
 
Stage {
    title: "MediaPlayer MM1"
    width: 500
    height: 500
    
       scene: Scene {
       width: 510
       height: 400
       content: 
          VBox {translateX: 10 translateY: 10 spacing: 20
                content: [
                	HBox {
                    	content: [
                    		VBox { 
                                content: [
	                                player,
		                            HBox {
		                              	content: [
		                               		Label {text: "Volume"}
		                               		slider,
			                               	Circle {
			                               	    centerX: 100,
			                               		centerY: 100,
			                               	    radius: 40,
			                               	    fill: Color.BLACK
			                               	    onMouseClicked: function( e: MouseEvent ): Void {
			                               	    println("CLICKED");    
			                               	    player.play();
			                               	    }
			                               	}
   				                            SwingButton {
   					                          	text: "Open"
   					                           	action: function() {
   					                           	    println("OPEN FILE");
   					                           	    isVisible = not isVisible;
   					                           	}
   				                            }
			                           	]
		                            },
   				                    HBox {
   				                    	visible: bind isVisible
   				                        content: [
   				                        	Label { text: "URL/FILE: "},
   				                        	fileBox,
   				                        	SwingButton {
   				                        	    text: "searchFile"
   				                        	    action: function() {
   				                        	        println("Search File");
   				                        	     	var chooser = new JFileChooser();
   				                        	       	if (chooser.showOpenDialog(null) == JFileChooser.APPROVE_OPTION) {
   				                        	          	fileBox.text = chooser.getSelectedFile().toURI().toString();
   				                        	       	}
   				                        	    }
   				                        	}
   				                        	SwingButton {
   				                        	    text: "Load"
   				                        	    action: function() {
   				                        	        println("Load");
   				                        	        player.setVideo(fileBox.text);
   				                        	        isVisible = false;
   				                        	    }
   				                        	}
   				                        ]
   				                    } 

	                            ]
                        	},
                            VBox {
                            	content: [
        	                     	Label {text: "Start:"}
        	                       	TextBox {} 
        	                     	Label {text: "Dauer"}
        	                       	TextBox {}  
   				                    SwingButton { 
   				                    	text: "Alpha"
   				                    	action: function() {
   				                    	    println("ALPHA");
   				                    	}
   				                    }
   				                    SwingButton{
   				                        text: "Wackeln"
   				                        action: function() {
   				                            println("WACKELN");
   				                        }
   				                    }  	                       	       	                       	
                                ]
                           	}
                       	]
					} 
				]
          }         
     }//Scene
}